﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using System.ServiceModel.Web;

namespace EIA.WCFService.AuthenticationService
{
    // 注意: 使用“重构”菜单上的“重命名”命令，可以同时更改代码和配置文件中的接口名“IService1”。
    [ServiceContract(SessionMode = SessionMode.NotAllowed)]
    public interface IAuthenticationService
    {
        /// <summary>
        /// 登录
        /// </summary>
        /// <param name="loginid">登录Id</param>
        /// <param name="pwd">登录密码</param>
        /// <returns>
        /// 
        /// </returns>
        [OperationContract]
        [WebGet(UriTemplate = "Login/{loginid}/{pwd}")]
        string Login(string loginid, string pwd);

        /// <summary>
        /// 注销
        /// </summary>
        /// <param name="token">登录成功后的获取的凭据</param>
        /// <returns>
        /// 0:success
        /// </returns>
        [OperationContract]
        [WebGet(UriTemplate = "Logout/{token}")]
        int Logout(string token);

        /// <summary>
        /// 获取用户唯一Id
        /// </summary>
        /// <param name="token">登录成功后的获取的凭据</param>
        /// <returns>
        /// Unique Id
        /// </returns>
        [OperationContract]
        [WebGet(UriTemplate = "GetUniqueId/{token}")]
        string GetUniqueId(string token);

        /// <summary>
        /// 登陆时间
        /// </summary>
        /// <param name="token"></param>
        /// <returns>yyyy-MM-dd HH:mm:ss</returns>
        [OperationContract]
        [WebGet(UriTemplate = "GetLoginTime/{token}")]
        string GetLoginTime(string token);

        /// <summary>
        /// 修改密码
        /// </summary>
        /// <param name="loginid"></param>
        /// <param name="oldpwd"></param>
        /// <param name="newpwd"></param>
        /// <returns></returns>
        [OperationContract]
        [WebGet(UriTemplate = "ChangePassword/{loginid}/{oldpwd}/{newpwd}")]
        bool ChangePassword(string loginid, string oldpwd, string newpwd);


        [OperationContract]
        [WebGet(UriTemplate = "clientaccesspolicy.xml")]
        System.IO.Stream GetClientAccessPolicy();
    }
}
